A yet smaller 'putbit' routine

TAD

(Yet smaller than the one in Hugi 25...)

The following should be pretty obvious. Call the 'init' with DS:DI pointing to the bitstream buffer, then call 'putbit' with a single bit in the CF (carry flag). Use the 'flush' to align the final bits in the byte.

 [DS:DI] --> bitstream buffer 
 CF --> the bit to write 
 
 D0 15      putbit: rcl byte ptr [di], 1 
 73 04              jnc short __ret 
 47                 inc di 
 C6 05 01    init:  mov byte ptr [di], 01h 
 C3         __ret:  ret 
 
 D0 25      flush:  shl byte ptr [di], 1 
 73 FC              jnc flush 
 C3                 ret 

That's all folks.

TAD